<?php
    $clientLibraryPath = '/home/dk1234/php/library';
    $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);

    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_AuthSub');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_HttpClient');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');

    // Parameters for ClientAuth authentication
    $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
    $user = "";
    $pass = "";

    // Create an authenticated HTTP client
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);

    // Create an instance of the Calendar service
    $service = new Zend_Gdata_Calendar($client);

    try {
    $listFeed= $service->getCalendarListFeed();
    } catch (Zend_Gdata_App_Exception $e) {
        echo "Error: " . $e->getMessage();
    }

    echo "<h1>Calendar List Feed</h1>";
    echo "<ul>";
    foreach ($listFeed as $calendar) {
        echo "<li>" . $calendar->title .
             " (Event Feed: " . $calendar->id . ")</li>";
    }
    echo "</ul>";
?>
